
#line 1 "..\message.c" /0
  
#line 1 "..\message.h" /0
 
 
 
 typedef char message;  
 
 
 
 extern void  PutMessage(message m);  
 extern void  PutMsg(char *strMsg);   
 extern void Message_task(void);  
 
 
#line 1 "..\message.c" /0
 
  
#line 1 "..\..\..\..\..\..\..\..\..\Keil_v5\C51\INC\string.h" /0







 
 
 
 
 
 
 
 typedef unsigned int size_t;
 
 
 
 
 
 
 #pragma SAVE
 #pragma REGPARMS
 extern char  *strcat  (char *s1, const char *s2);
 extern char  *strncat (char *s1, const char *s2, size_t n);
 
 extern char   strcmp  (const char *s1, const char *s2);
 extern char   strncmp (const char *s1, const char *s2, size_t n);
 
 extern char  *strcpy  (char *s1, const char *s2);
 extern char  *strncpy (char *s1, const char *s2, size_t n);
 
 extern size_t strlen  (const char *);
 
 extern char  *strchr  (const char *s, char c);
 extern int    strpos  (const char *s, char c);
 extern char  *strrchr (const char *s, char c);
 extern int    strrpos (const char *s, char c);
 
 extern size_t strspn  (const char *s, const char *set);
 extern size_t strcspn (const char *s, const char *set);
 extern char  *strpbrk (const char *s, const char *set);
 extern char  *strrpbrk(const char *s, const char *set);
 extern char  *strstr  (const char *s, const char *sub);
 extern char  *strtok  (char *str, const char *set);
 
 extern char   memcmp  (const void *s1, const void *s2, size_t n);
 extern void  *memcpy  (void *s1, const void *s2, size_t n);
 extern void  *memchr  (const void *s, char val, size_t n);
 extern void  *memccpy (void *s1, const void *s2, char val, size_t n);
 extern void  *memmove (void *s1, const void *s2, size_t n);
 extern void  *memset  (void *s, char val, size_t n);
 #pragma RESTORE
 
 
#line 2 "..\message.c" /0
 
  
#line 1 "..\main.h" /0
 
 
 
 typedef unsigned char BYTE;
 extern void SendData(BYTE dat);
 
 
#line 3 "..\message.c" /0
 
 
 
 
 char Messages[64];    
 unsigned char MessageHead = 0;       
 unsigned char MessageTail = 0;       
 
 void PutMessage(char m);
 
 
 void PutMessage(char m)
 {
 Messages[MessageTail] = m ;
 if(++MessageTail>=(64)) MessageTail=0;
 }
 
 message GetMessage(void)
 {
 message m = Messages[MessageHead];
 if(++MessageHead>=64) MessageHead=0;
 return m ;
 }
 
 bit     QueueEmptyOrError(void)
 {
 return (MessageHead==MessageTail)?1:0;
 }
 
 void Message_task(void)
 {
 unsigned char bCount;
 static unsigned int delayRS232;
 
 if(++delayRS232>200)   
 {
 delayRS232=0;
 if(!QueueEmptyOrError())
 {
 for(bCount=0; bCount<64; bCount++) {
 
 
 
 SendData(Messages[bCount]);
 
 }
 SendData('\r');
 SendData('\n');
 }
 
 }
 }
 
 void PutNumMsg(unsigned char num)
 {
 
 PutMessage(0x30+(num&0xFF)/10);
 PutMessage(0x30+(num&0xFF)%10);
 }
 
 void PutMsg(char *strMsg)
 {
 unsigned int i;
 unsigned int length = strlen(strMsg);
 
 for(i=0;i<length;i++) 
 {
 PutMessage(strMsg[i]);
 PutMessage(strMsg[i+1]);  
 i++;
 }
 }
 char HexToChar(char temp)
 {
 char dst;
 if (temp < 10) {
 dst = temp + '0';
 } else {
 dst = temp -10 +'A';
 }
 return dst;
 }































 
